﻿<html>
<head>
    <title>Process information</title>
    <!--[if IE]><script language="javascript" type="text/javascript" src="resource.ashx?f=excanvas.js"></script><![endif]-->
    <script type="text/javascript" src="resource.ashx?f=jquery-1.3.2.min.js"></script>
    <script type="text/javascript">var _ = jQuery.noConflict();</script>
    <script type="text/javascript" src="resource.ashx?f=jquery.flot.js"></script>    
</head>
<body>
    <h2>Process information</h2>
    Started: $startTime<br />
    Up time: $upTime<br />
    
    <h2>Memory stats</h2>
    Working set size: $workingSet (peak $workingSet_Peak)<br />
    Virtual memory size: $virtualMem (peak $virtualMem_Peak)<br />
    Paged memory size: $pagedMem (page $pagedMem_Peak)<br />
    
    
    <h2>ASP.NET Performance Counters</h2>
    <table>
    #foreach ($i in $perfCounters_aspnet)
    <tr>
        <td>$i.Key</td>
        <td>$i.Value</td>
        <td><input type="button" class="plot" value="Plot" key="$i.Key" /></td>
    </tr>
    #end
    </table>
    <div id="graph" style="width:600px;height:300px;"></div>
    
    <script type="text/javascript">
    _(function() {
        var graphData = [];
        var fetchPoint = function(counter) {
            _.get("PerfCounter.ashx", {cat: 'ASP.NET', counter: counter, rnd: Math.random()}, function(data) {
                graphData.push([new Date().getTime(), data]);
                _.plot(_('#graph'), [graphData], { xaxis: {mode: 'time'}});
            });
            setTimeout(function() { fetchPoint(counter) }, 1000);
        };
        _('.plot').click(function(){
            graphData = [];
            fetchPoint(this.getAttribute('key'));
        });
    });
    </script>
</body>
</html>
